import type { TopicForm } from './model';

import type { ID, IDS, PageQuery } from '#/api/common';

import { requestClient } from '#/api/request';
/**
 * topic列表
 * @param params
 */
export function topicList(params?: PageQuery) {
  return requestClient.get(`/iot/product/topic/page`, { params });
}
/**
 * 新增topic
 * @param data
 */
export function saveTopic(data: Partial<TopicForm>) {
  return requestClient.postWithMsg(`/iot/product/topic/add`, data);
}
/**
 * 修改topic
 * @param data
 */
export function updateTopic(data: Partial<TopicForm>) {
  return requestClient.postWithMsg(`/iot/product/topic/update`, data);
}

/**
 * topic详情
 * @param id
 */
export function getTopicDetail(id: ID | IDS) {
  return requestClient.get(`/iot/product/topic/detail?id=${id}`);
}

/**
 * 删除topic
 * @param id
 * @returns
 */

export function removeTopic(id: ID | IDS) {
  return requestClient.post(`/iot/product/topic/remove?id=${id}`);
}
